<!DOCTYPE html>
<html>
  <head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <title><?php echo isset($title) ? $title : '';?></title>
      <!-- 设置缩放 -->
      <meta name="viewport" content="minimal-ui,width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
      <!-- IOS中禁用将数字识别为电话号码/忽略Android平台中对邮箱地址的识别 -->
      <meta name="format-detection" content="telephone=no" />
      <!-- windows phone 点击无高光 -->
      <meta name="msapplication-tap-highlight" content="no" />
      <!-- icon -->
      <link rel="shortcut icon" href="<?php echo ADMIN_ICO_PIC;?>" type="image/x-icon"/>
      <!-- css -->
      <link rel="stylesheet" type="text/css" href="<?php echo SYS_LINK;?>admin/css/content.css?v=<?php echo V_CSSJS;?>" />

      <style>
          .form_item .hint .show_pic_btn {margin-bottom: -4px;}
          .ahref_blue{color:#0086b3;cursor:pointer;}
          .form_item .radio {min-width: auto;}
          <?php if($userLevel != 1){ ?>.form_item_hide{display: none;}<?php } ?>
          #title_txt{width:700px;text-align: center;color:#15b1c5;line-height: 30px;border-top: 1px dashed #6ca3b3;padding-top: 5px;}
          #hint_txt{font-size:12px;color:#aaaaaa;}
      </style>
  </head>
<body class="noselect">
<?php
$userLevel = isset($userLevel) ? $userLevel : 0;
$powerInfo = isset($powerInfo) ? $powerInfo : powerInfoListDeVal();
?>
<div class="con_box">
    <!-- tab导航 -->
    <?php include SYS_PATH.SYS_APP_PATH.'/admin/views/admin_system/navtab.php';?>

	<?php
	if(isset($res) && !empty($res)){
	?>
    <form class="form_box" id="imgViewerBox">

        <!-- ------------------------------------------------------------------- -->
        <div class="form_item">
            <label>系统名称：</label>
            <input type="text" name="sys_name" id="sys_name" value="<?php echo $res['sys_name']; ?>"/>
            <i class="hint"> * 系统名称</i>
        </div>
        <div class="form_item">
            <label>多号登录：</label>
            <label class="radio"><input type="radio" name="user_flag" value="1" <?php echo $res['user_flag']==1 ? 'checked="checked"' : '';?>>开启</label>&nbsp;&nbsp;&nbsp;&nbsp;
            <label class="radio"><input type="radio" name="user_flag" value="2" <?php echo $res['user_flag']==2 ? 'checked="checked"' : '';?>>关闭</label>&nbsp;&nbsp;&nbsp;&nbsp;
            <i class="hint"> * 后台是否开启第三方账号登录（手机、邮箱）</i>
        </div>
        <div class="form_item">
            <label>缓存版本：</label>
            <input type="text" name="v_cssjs" id="v_cssjs" value="<?php echo $res['v_cssjs']; ?>"/>
            <i class="hint"> * 前端缓存刷新（刷新后提交保存）<span id="cache_clear" class="ahref_blue">[刷新缓存]</span></i>
        </div>
        <div class="form_item">
            <label>分页数值：</label>
            <input type="text" name="sys_pages" id="sys_pages" value="<?php echo $res['sys_pages']; ?>"/>
            <i class="hint"> * 系统后台内容每页显示的条数</i>
        </div>
        <div class="form_item">
            <label>登录页图：</label>
            <input type="text" name="login_pic" id="login_pic" class="login_pic filebox_val" value="<?php echo $res['login_pic']; ?>"/>
            <i class="hint">
                <?php if($res['login_pic']){?>
                <img src="<?php echo SYS_LINK;?>admin/img/common/pic.png" class="show_pic_btn"
                     img_src="<?php echo SYS_LINK.$res['login_pic']; ?>"> &nbsp;
                <?php } ?>
                登录页背景图<span id="loginsrc" class="ahref_blue">[填入初始图]</span>
            </i>
        </div>
        <div class="form_item">
            <label>左菜单宽：</label>
            <input type="text" name="left_nav_width" id="left_nav_width" value="<?php echo $res['left_nav_width']?>"/>
            <i class="hint"> * 左侧菜单栏宽度（像素）</i>
        </div>
        <div class="form_item ">
            <label>邮箱服务：</label>
            <input type="text" name="email_smtp" id="email_smtp" value="<?php echo $res['email_smtp']; ?>"/>
            <i class="hint"> * 系统发件邮箱smtp服务地址<span id="emailsmtp" class="ahref_blue">[一键配置默认邮箱]</span></i>
        </div>
        <div class="form_item">
            <label>发件邮箱：</label>
            <input type="text" name="email_address" id="email_address" value="<?php echo $res['email_address']; ?>"/>
            <i class="hint"> * 邮箱帐号</i>
        </div>
        <div class="form_item">
            <label>邮箱密码：</label>
            <input type="password" name="email_pwd" id="email_pwd" value="<?php echo $res['email_pwd']; ?>"/>
            <i class="hint"> * 邮箱smtp服务密码</i>
        </div>
        <div class="form_item">
            <label>邮箱昵称：</label>
            <input type="text" name="email_nick" id="email_nick" value="<?php echo $res['email_nick']; ?>"/>
            <i class="hint"> * 邮件自定义昵称</i>
        </div>
        <div class="form_item" <?php echo $userLevel != 1 ? 'style="display:none"' : '';?> >
            <label>收件邮箱：</label>
            <input type="text" name="email_accept" id="email_accept" value="<?php echo $res['email_accept']; ?>"/>
            <i class="hint"> - 验证邮箱是否能接收到邮件，点击测试:<?php if($userLevel == 1){ ?><span id="emailtext" class="ahref_blue">[发送测试邮件]</span><?php } ?></i>
        </div>
        <div class="form_item">
            <label>服务密钥：</label>
            <input type="text" name="key_id" id="key_id" value="<?php echo $res['key_id'];?>" autocomplete="off"  />
            <i class="hint"> * 请勿修改，用于激活网站</i>
        </div>
        <!---------------------------------------------------------------------------------------------------->
        <div class="form_item form_item_hide" id="title_txt"> ↓ 开发者配置 ↓ <span id="hint_txt"> * 非开发者帐号以下内容不展示</span></div>
        <?php if($userLevel == 1){ ?>
            <div class="form_item" >
                <label>后台维护：</label>
                <label class="radio"><input type="radio" name="admin_uphold" value="1" <?php echo $res['admin_uphold']==1 ? 'checked="checked"' : '';?>>开启</label>&nbsp;&nbsp;&nbsp;&nbsp;
                <label class="radio"><input type="radio" name="admin_uphold" value="2" <?php echo $res['admin_uphold']==2 ? 'checked="checked"' : '';?>>关闭</label>&nbsp;&nbsp;&nbsp;&nbsp;
                <i class="hint"> * 开启后后台不能访问</i>
            </div>
            <div class="form_item">
                <label>网站维护：</label>
                <label class="radio"><input type="radio" name="web_uphold" value="1" <?php echo $res['web_uphold']==1 ? 'checked="checked"' : '';?>>开启</label>&nbsp;&nbsp;&nbsp;&nbsp;
                <label class="radio"><input type="radio" name="web_uphold" value="2" <?php echo $res['web_uphold']==2 ? 'checked="checked"' : '';?>>关闭</label>&nbsp;&nbsp;&nbsp;&nbsp;
                <i class="hint"> * 开启后网站不能访问</i>
            </div>
            <?php
        }else{
            echo '<input type="hidden" name="admin_uphold" value="'.$res["admin_uphold"].'">';
            echo '<input type="hidden" name="web_uphold" value="'.$res["web_uphold"].'">';
        }
        $saveDisplayNone = in_array('admin_system_syssave', $powerInfo['classfun']) || $userLevel == 1 ? '' : 'userLevelNone';
        ?>
        <div class="form_item form_item_hide">
            <label>图片验证：</label>
            <label class="radio"><input type="radio" name="verify_flag" value="1" <?php echo $res['verify_flag']==1 ? 'checked="checked"' : '';?>>开启</label>&nbsp;&nbsp;&nbsp;&nbsp;
            <label class="radio"><input type="radio" name="verify_flag" value="2" <?php echo $res['verify_flag']==2 ? 'checked="checked"' : '';?>>关闭</label>&nbsp;&nbsp;&nbsp;&nbsp;
            <i class="hint"> * 控制全站图片验证码是否开启</i>
        </div>
        <div class="form_item form_item_hide">
            <label>网站统计：</label>
            <label class="radio"><input type="radio" name="counts_flag" value="1" <?php echo $res['counts_flag']==1 ? 'checked="checked"' : '';?>>开启</label>&nbsp;&nbsp;&nbsp;&nbsp;
            <label class="radio"><input type="radio" name="counts_flag" value="2" <?php echo $res['counts_flag']==2 ? 'checked="checked"' : '';?>>关闭</label>&nbsp;&nbsp;&nbsp;&nbsp;
            <i class="hint"> * 网站统计开关</i>
        </div>
        <div class="form_item form_item_hide">
            <label>统计分表：</label>
            <label class="radio"><input type="radio" name="counts_type" value="1" <?php echo $res['counts_type']==1 ? 'checked="checked"' : '';?>>年分</label>&nbsp;&nbsp;&nbsp;&nbsp;
            <label class="radio"><input type="radio" name="counts_type" value="2" <?php echo $res['counts_type']==2 ? 'checked="checked"' : '';?>>月分</label>&nbsp;&nbsp;&nbsp;&nbsp;
            <i class="hint"> * 网站统计分表类型</i>
        </div>
        <div class="form_item form_item_hide">
            <label>静态开关：</label>
            <label class="radio"><input type="radio" name="still_flag" value="1" <?php echo $res['still_flag']==1 ? 'checked="checked"' : '';?>>开启</label>&nbsp;&nbsp;&nbsp;&nbsp;
            <label class="radio"><input type="radio" name="still_flag" value="2" <?php echo $res['still_flag']==2 ? 'checked="checked"' : '';?>>关闭</label>&nbsp;&nbsp;&nbsp;&nbsp;
            <i class="hint"> * 纯页面静态开关，开启需要手动生成静态文件</i>
        </div>
        <div class="form_item form_item_hide">
            <label>操作日志：</label>
            <label class="radio"><input type="radio" name="sys_log_flag" value="1" <?php echo $res['sys_log_flag']==1 ? 'checked="checked"' : '';?>>开启</label>&nbsp;&nbsp;&nbsp;&nbsp;
            <label class="radio"><input type="radio" name="sys_log_flag" value="2" <?php echo $res['sys_log_flag']==2 ? 'checked="checked"' : '';?>>关闭</label>&nbsp;&nbsp;&nbsp;&nbsp;
            <i class="hint"> * 用户操作系统日志</i>
        </div>
        <div class="form_item form_item_hide">
            <label>多菜单关联：</label>
            <label class="radio"><input type="radio" name="classmore_flag" value="1" <?php echo $res['classmore_flag']==1 ? 'checked="checked"' : '';?>>开启</label>&nbsp;&nbsp;&nbsp;&nbsp;
            <label class="radio"><input type="radio" name="classmore_flag" value="2" <?php echo $res['classmore_flag']==2 ? 'checked="checked"' : '';?>>关闭</label>&nbsp;&nbsp;&nbsp;&nbsp;
            <i class="hint"> * 文章关联多菜单下展示</i>
        </div>
        <div class="form_item form_item_hide">
            <label>多模版开关：</label>
            <label class="radio"><input type="radio" name="web_temp_flag" value="1" <?php echo $res['web_temp_flag']==1 ? 'checked="checked"' : '';?>>开启</label>&nbsp;&nbsp;&nbsp;&nbsp;
            <label class="radio"><input type="radio" name="web_temp_flag" value="2" <?php echo $res['web_temp_flag']==2 ? 'checked="checked"' : '';?>>关闭</label>&nbsp;&nbsp;&nbsp;&nbsp;
            <i class="hint"> * 开启后电脑端移动端区分模版</i>
        </div>
        <div class="form_item form_item_hide">
            <label>电脑端模版：</label>
            <input type="text" name="web_temp_p" id="web_temp_p" value="<?php echo $res['web_temp_p']; ?>"/>
            <i class="hint"> * 前端默认模版路径</i>
        </div>
        <div class="form_item form_item_hide">
            <label>移动端模版：</label>
            <input type="text" name="web_temp_m" id="web_temp_m" value="<?php echo $res['web_temp_m']; ?>"/>
            <i class="hint"> * 前端移动端模版路径</i>
        </div>
        <div class="form_item form_item_hide">
            <label>图片最大值：</label>
            <input type="text" name="update_pic_size" id="update_pic_size" value="<?php echo $res['update_pic_size']; ?>"/>
            <i class="hint"> /Kb * 控制全站图片上传最大值控制</i>
        </div>
        <div class="form_item form_item_hide">
            <label>传图片类型：</label>
            <input type="text" name="update_pic_type" id="update_pic_type" value="<?php echo $res['update_pic_type']; ?>"/>
            <i class="hint"> * 控制全站图片上传类型,多个用"|"隔开</i>
        </div>
        <div class="form_item form_item_hide">
            <label>文件最大值：</label>
            <input type="text" name="update_size" id="update_size" value="<?php echo $res['update_size']; ?>"/>
            <i class="hint"> /Kb * 控制全站文件上传最大值控制</i>
        </div>
        <div class="form_item form_item_hide">
            <label>传文件类型：</label>
            <input type="text" name="update_type" id="update_type" value="<?php echo $res['update_type']?>"/>
            <i class="hint"> * 控制全站文件上传类型,多个用"|"隔开</i>
        </div>
        <div class="form_item form_item_hide">
            <label>系统主页面：</label>
            <input type="text" name="sys_main_flag" id="sys_main_flag" value="<?php echo $res['sys_main_flag']?>"/>
            <i class="hint"> * 系统主页面版式（1H5，2APP）</i>
        </div>
        <div class="form_item form_item_hide">
            <label>服务倒计时：</label>
            <input type="text" name="end_date" id="end_date" value="<?php echo $res['end_date']; ?>" autocomplete="off" readonly />
            <i class="hint"> * 到期自动关闭网站</i>
        </div>
        <?php
        $saveDisplayNone = in_array('admin_system_syssave', $powerInfo['classfun']) || $userLevel == 1 ? '' : 'userLevelNone';
        ?>
        <div class="form_item <?php echo $saveDisplayNone;?>">
            <label style="color:#ff7f77"> 编辑需保存 </label>
            <input type="button" id="sub_btn" value="提交保存" class="btn_base btn_back_sides btn_w300 btn_height35 btn_radius5">
        </div>
    </form>
	
	<?php 
	}else{
		echo '<div>没有找到相关信息</div>';
	}
	?>
</div>

</body>
<script language="javascript">
    var cssjsv = '<?php echo V_CSSJS;?>';
    var http_url = '<?php echo SYS_HOST;?>';
    var http_link = '<?php echo SYS_LINK;?>';
    var http_fix = '<?php echo SYS_URL_FIX;?>';
</script>
<script type="text/javascript" src="<?php echo SYS_LINK;?>admin/js/jquery.min.js?v=<?php echo V_CSSJS;?>"></script>
<script type="text/javascript" src="<?php echo SYS_LINK;?>admin/js/skin.js?v=<?php echo V_CSSJS;?>"></script>
<script type="text/javascript" src="<?php echo SYS_LINK;?>admin/js/common.js?v=<?php echo V_CSSJS;?>"></script>
<script type="text/javascript">file_load('info');</script>
<script language="javascript">
    var addUrl = '<?php echo SYS_URL_PATH('admin_system_syssave');?>';
    var picUploadUrl = '<?php echo SYS_URL_PATH('c_upload_base64upload/go/1');?>';
    var emailtestUrl = '<?php echo SYS_URL_PATH('c_email_test');?>';
    // 页面加载完毕
    window.onload = function () {
        // 图片预览
        var viewer = new Viewer(document.getElementById('imgViewerBox'), {
            url: 'img_src'
        });

        // 日期时间
        jeDate({
            dateCell:'#end_date',
            isTime:true,
            format:'YYYY-MM-DD hh:mm:ss'
        })

    }
    // jquery
    $(function(){
        var flagSub = true;
        $('#sub_btn').on('click',function(){
            if(!flagSub){
                layer.msg('处理中……(禁止重复提交)');return false;
            }
            flagSub = false;
            var fromBox = $('.form_box');
            var param = getFormData(fromBox);
            param.append('flag', 'Y'); // 增加参数
            $.ajax({
                url:addUrl,
                dataType:'json',
                type:'POST',
                async: false,
                data: param,
                processData : false, // 使数据不做处理
                contentType : false, // 不要设置Content-Type请求头
                success: function(data){
                    flagSub = true;
                    if(data=='Y'){
                        layer.msg('保存成功');
                        setTimeout(function(){
                            parent.location.reload();
                        },2500);
                    }else{
                        layer.msg('保存失败');
                    }
                },
                error:function(response){
                    flagSub = true;
                    console.log('网络异常：'+response);
                }
            });
        })
    })


    /*
     * ico图片上传
     */
    /*$("#ico_pic").on('click',function (){
        var param = [];
        param['zhl_upload_url'] = "//echo HTTP_PATH.'c_upload_base64upload/go/1.html'; ?>";; //上传url,必须
        param['zhl_upload_num'] = 1; 		  //上传数量控制,可选，int 默认1
        param['zhl_upload_size'] = 1024*50;	  //上传大小，int b 默认2M,当前50kb
        param['zhl_upload_box'] = '#ico_pic'; //可选  选择器 上传成功信息盒子
        param['zhl_upload_css'] = 'zhl_upload_css_one';	//可选 默认 zhl_upload_css_one
        //zhl_upload_show(param);
        $('body').zhlUploads(param,function(e){});
    })*/

    /*
     * 登录页图片上传
     */
    $("#login_pic").on('click',function (){
        var param = [];
        param['zhl_upload_url'] = picUploadUrl; //上传url,必须
        param['zhl_upload_num'] = 1; 		  //上传数量控制,可选，int 默认1
        param['zhl_upload_size'] = <?php echo 1024*$GLOBALS['ADMIN']['update_pic_size'];?>;	  //上传大小，int b 默认2M,//500kb
        param['zhl_upload_box'] = '#login_pic'; //可选  选择器 上传成功信息盒子
        param['zhl_upload_css'] = 'zhl_upload_css_one';	//可选 默认 zhl_upload_css_one
        //zhl_upload_show(param);
        $('body').zhlUploads(param,function(e){});
    })


    // 位数不足补齐
    var polishint = function() {
        var tbl = [];
        return function(num, n) {
            var len = n-num.toString().length;
            if (len <= 0) return num;
            if (!tbl[len]) tbl[len] = (new Array(len+1)).join('0');
            return tbl[len] + num;
        }
    }();
    /**
     * 清理系统缓存
     */
    var cache_clear = document.getElementById("cache_clear");
        cache_clear.onclick = function(){
            var sysDate = new Date();
            var Y = polishint(sysDate.getFullYear(),4);
            var M = polishint((sysDate.getMonth()+1),2);
            var D = polishint(sysDate.getDate(),2);
            var H = polishint(sysDate.getHours(),2);
            var I = polishint(sysDate.getMinutes(),2);
            var S = polishint(sysDate.getSeconds(),2);
            var dateStr = Y+''+M+''+D+''+H+''+I+''+S;
            document.getElementById("v_cssjs").value = dateStr;
        };

    /**
     * 填入默认背景图
     */
    $('#loginsrc').click(function(){
        var imgsrc = 'admin/img/common/back_login1.jpg';
        $('#login_pic').val(imgsrc);
        //$(this).siblings('.show_pic').show();
        //$(this).siblings('.show_pic').attr('data-src',imgsrc);
    })

    /**
     * 一键配置邮箱信息
     */
    $('#emailsmtp').click(function(){
        $('#email_smtp').val('smtp.163.com');
        $('#email_address').val('websinfo@163.com');
        $('#email_pwd').val('NFPUOCWSWQLUQJCN');
        $('#email_nick').val('站点消息');
    });

    /**
     * 发送邮件测试
     */
    $('#emailtext').click(function(){
        layer.confirm('确定发送测试邮件进行邮箱配置测试？', {
            btn: ['确定','取消'] //按钮
        }, function(){
            var email_smtp = $('#email_smtp').val();
            var email_address = $('#email_address').val();
            var email_pwd = $('#email_pwd').val();
            var email_nick = $('#email_nick').val();
            var email_accept = $('#email_accept').val();
            $.post(emailtestUrl,{
                email_smtp:email_smtp,
                email_address:email_address,
                email_pwd:email_pwd,
                email_nick:email_nick,
                email_accept:email_accept
            },function(data){
                if(data == 'Y'){
                    layer.msg('邮件发送成功！');
                }else{
                    layer.msg('邮件发送失败：'+data);
                }
            },'json').error(function (xhr, status, info) {
                layer.msg('网络错误');
            });
        }, function(){

        });
    });

</script>
</html>